package com.lzw.breezeNovel.webApp.task;

import com.lzw.breezeNovel.webApp.service.impl.video.VideoLikeServiceImpl;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

/**
 * @author 清风明月
 * @Package com.lzw.breezeNovel.webApp.task
 * @date 2025/3/24
 * @description 视频的定时任务
 */
@Slf4j
@Component
@SuppressWarnings("all")
public class VideoTask {

   /**
    * 注入短视频
    */
   @Autowired
   private VideoLikeServiceImpl videoLikeService;

 /**
  * 使用定时任务->梅5分执行一次把redis里面的数据同步到数据库
  */
   @Scheduled(cron = "0 0/5 * * * ?")
   public void syncVideoLikeToDb() {
       try {
         videoLikeService.syncRedisToDatabase();
       }catch (Exception e)
       {
         log.error("同步异常",e);
       }
   }

}
